import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import permission from '@/directive/permission'

export default {
  install(Vue) {
    Vue.use(ElementUI)
    Vue.directive('permission', permission)
    
    // 全局方法
    Vue.prototype.$formatDate = (date) => {
      return new Date(date).toLocaleDateString()
    }
    
    // 全局过滤器
    Vue.filter('statusFilter', (status) => {
      const statusMap = {
        1: '正常',
        2: '停用'
      }
      return statusMap[status]
    })
  }
} 